package cn.arnold.offer.shenyan.test1;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Arnold-Xiang
 * @Info
 */
public class Solutio {
    public static void main(String[] args) {
        getLongs("abcaakjbb");
    }
    public static void getLongs(String words)
    {
        Pattern pattern = Pattern.compile("([a-zA-Z])\\1+");
        Matcher matcher = pattern.matcher(words);
        String word = "";
        List<String> list = new ArrayList<>();
        while (matcher.find())
        {
            String index = matcher.group();
            if (word.length() <= index.length())
            {
                word = index;
                String temp =  index.substring(0, 1) + ":" + index.length();
                list.add(temp);
            }

        }

        for (String s : list) {
            System.out.println(s);
        }
    }
}
